//
//  ChatMessageCell.m
//  QuickCure
//
//  Created by Ruihaha on 16/9/16.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "ChatMessageCell.h"
#import <UIImageView+WebCache.h>

@interface ChatMessageCell ()

@property(nonatomic,strong)UIImageView * icon;
@property(nonatomic,strong)UIButton * message;
@end

@implementation ChatMessageCell

-(void)setModel:(DoctorModel *)model{

    _model = model;
    
    self.icon=[[UIImageView alloc]init];
    [self.icon sd_setImageWithURL:[NSURL URLWithString:model.doctor_portrait]];
    [self addSubview:self.icon];
    if (!self.icon.image) {
        
        self.icon.image = [UIImage imageNamed:@"illness_img_person.png"];
    }
    self.icon.layer.cornerRadius=30;
    self.icon.clipsToBounds=YES;
    [self.icon makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(5);
        make.left.equalTo(20);
        make.size.equalTo(60);
    }];
    
    self.message = [[UIButton alloc]init];
    self.message.backgroundColor=WHITE_COLOR;
    self.message.alpha = 0.7;
    [self.message setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self addSubview:self.message];
    [self.message setTitle:@"您好,有什么能帮助您的吗?" forState:UIControlStateNormal];
    self.message.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.message makeConstraints:^(MASConstraintMaker *make) {

        make.left.equalTo(self.icon.mas_right).offset(10);
        make.centerY.equalTo(self.icon);
        make.right.equalTo(self).offset(-10);
        
    }];
}

@end
